﻿namespace OboutInc.EasyMenu_Pro
{
    using System;
    using System.ComponentModel;
    using System.Drawing.Design;
    using System.Web.UI.Design;
    using System.Xml;

    [Serializable, ToolboxItem(false)]
    public class MenuSeparator : ItemBase
    {
        public MenuSeparator()
        {
            this.InnerHtml = "<hr noshade size=1>";
        }

        public MenuSeparator(string id) : this()
        {
            this.ID = id;
        }

        public MenuSeparator(string id, string InnerHtml) : this(id)
        {
            this.InnerHtml = (InnerHtml != string.Empty) ? InnerHtml : "<hr noshade size=1>";
        }

        public override void Deserialize(XmlElement parentNode)
        {
            this.ID = parentNode.GetAttribute("ID");
            this.InnerHtml = parentNode.GetAttribute("InnerHtml");
            this.AllowsIcon = bool.Parse(parentNode.GetAttribute("AllowsIcon"));
        }

        public override void Serialize(ref XmlElement parentNode)
        {
            parentNode.SetAttribute("ID", this.ID);
            parentNode.SetAttribute("InnerHtml", this.InnerHtml);
            parentNode.SetAttribute("AllowsIcon", this.AllowsIcon.ToString());
        }

        public override string AddonAttributes
        {
            get
            {
                return string.Empty;
            }
        }

        [Bindable(true), Category("Appearance"), DefaultValue(false), Description("Image to show near the MenuItem.")]
        public override bool AllowsIcon
        {
            get
            {
                object obj2 = this.ViewState["AllowsIcon"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                this.ViewState["AllowsIcon"] = value;
            }
        }

        [DefaultValue(true), Description("If the menu should hide upon clicking this item or not."), Bindable(true), Category("Behavior")]
        public override bool AutoHideMenu
        {
            get
            {
                return true;
            }
            set
            {
            }
        }

        public static string Component
        {
            get
            {
                return "easyMenuSeparator";
            }
        }

        public static string ComponentContentCell
        {
            get
            {
                return "easyMenuSeparatorContentCell";
            }
        }

        public static string ComponentContentCellOver
        {
            get
            {
                return "easyMenuSeparatorContentCellOver";
            }
        }

        public static string ComponentIconCell
        {
            get
            {
                return "easyMenuSeparatorIconCell";
            }
        }

        public static string ComponentIconCellOver
        {
            get
            {
                return "easyMenuSeparatorIconCellOver";
            }
        }

        public static string ComponentLeftRoundCornerCell
        {
            get
            {
                return "easyMenuSeparatorLeftRoundCornerCell";
            }
        }

        public static string ComponentLeftRoundCornerCellOver
        {
            get
            {
                return "easyMenuSeparatorLeftRoundCornerCellOver";
            }
        }

        public static string ComponentOver
        {
            get
            {
                return "easyMenuSeparatorOver";
            }
        }

        public static string ComponentRightRoundCornerCell
        {
            get
            {
                return "easyMenuSeparatorRightRoundCornerCell";
            }
        }

        public static string ComponentRightRoundCornerCellOver
        {
            get
            {
                return "easyMenuSeparatorRightRoundCornerCellOver";
            }
        }

        public static string ComponentSubMenuCell
        {
            get
            {
                return "easyMenuSeparatorSubMenuCell";
            }
        }

        public static string ComponentSubMenuCellOver
        {
            get
            {
                return "easyMenuSeparatorSubMenuCellOver";
            }
        }

        [Bindable(true), Category("Appearance"), Editor(typeof(UrlEditor), typeof(UITypeEditor)), Description("Image to show near the MenuItem."), DefaultValue("")]
        public override string Icon
        {
            get
            {
                if (this.AllowsIcon)
                {
                    object obj2 = this.ViewState["Icon"];
                    if (obj2 != null)
                    {
                        return (string) obj2;
                    }
                }
                return string.Empty;
            }
            set
            {
                this.ViewState["Icon"] = value;
            }
        }

        [NotifyParentProperty(true), Bindable(true), Category("Behavior"), DefaultValue("&nbsp;"), Description("Text or any client side code to display.")]
        public override string InnerHtml
        {
            get
            {
                object obj2 = this.ViewState["InnerHTML"];
                if (obj2 != null)
                {
                    return (string) obj2;
                }
                return "&nbsp;";
            }
            set
            {
                this.ViewState["InnerHTML"] = value;
            }
        }
    }
}

